import org.example.Myql;

import java.sql.*;

public class Mdd {

    public static void main(String[] args) throws ClassNotFoundException, SQLException {
//        Class.forName("com.mysql.cj.jdbc.Driver");
//        // 创建连接
//        String url = "jdbc:mysql://localhost:3306/student?useSSL=false&useUnicode=true&characterEncoding=utf8";
//        String username = "root";
//        String password = "123456";
//        Connection conn = DriverManager.getConnection(url, username, password);
        Connection conn = Myql.gitconn();
        // 创建stmt对象
        Statement stmt = conn.createStatement();

        String select = "select * from student";
        ResultSet rs = stmt.executeQuery(select);
        // 返回结果  
//            if (rs.next()) {  
        while (rs.next()) {
            int stuId = rs.getInt("id");
            String name = rs.getString("name");
/*            String birth = rs.getString("s_birth");
            String sex = rs.getString("s_sex");*/
            System.out.println(stuId + "\t" + name);
        }

    }
}